
package hasthi.wsdm.capabilities;

import hasthi.common.HasthiException;
import hasthi.common.HasthiException.FaultCode;
import hasthi.common.constants.WSDMConstants;
import hasthi.wsdm.ManagedSystemHandle;

import java.util.Date;

import javax.xml.namespace.QName;

import org.apache.xmlbeans.XmlCalendar;

/**
 * Represents the Matric collecting capability.
 * @author hperera
 *
 */

public class MetricsCapability extends AbstractCapability{
    /**
     * Following are defined matrics. They shall be enable by adding parameters to managment configuration file and 
     * if added, they must be defined by SystemHandle. 
     */
    public static QName CURRENT_TIME = new QName(WSDMConstants.MUWS2_NAMESPACE,"CurrentTime");
    public static QName PENDING_REQUESTS = new QName(WSDMConstants.EXTREME_MANAGEMENT_NS,"NumberOfPendingRequests");
    public static QName FALIED_REQUESTS = new QName(WSDMConstants.MUWS2_NAMESPACE,"NumberOfFailedRequests");
    public static QName MAX_RESPONSE_TIME = new QName(WSDMConstants.MUWS2_NAMESPACE,"MaxResponseTime");
    public static QName LAST_RESPONSE_TIME = new QName(WSDMConstants.MUWS2_NAMESPACE,"LastResponseTime");
    public static QName NUMBER_OF_SUCCESSFUL_REQUESTS = new QName(WSDMConstants.MUWS2_NAMESPACE,"NumberOfSuccessfulRequests");
    public static QName SERVICE_START_TIME = new QName(WSDMConstants.MUWS2_NAMESPACE,"ServiceStartTime");
    public static QName LAST_REQUEST_RECIVED_TIME = new QName(WSDMConstants.EXTREME_MANAGEMENT_NS,"LastRequestRecivedTime");
    
    
    public void setProperty(QName name, Object value) throws HasthiException {
        throw new HasthiException("Unsupported property "+name + " set in capability "+ this,FaultCode.InvaliedLocalArgumnet);
    }
    
    public Object getProperty(QName name) throws HasthiException {
        return ownedResource.getSystemHandle().getMatric(name);
    }
}

